package com.ahcloud.edas.gatewaylog.api.controller;

import com.ahcloud.edas.common.domain.common.PageResult;
import com.ahcloud.edas.common.domain.common.ResponseResult;
import com.ahcloud.edas.gatewaylog.biz.application.manager.GatewayAccessLogManager;
import com.ahcloud.edas.gatewaylog.biz.domain.log.query.LogListQuery;
import com.ahcloud.edas.gatewaylog.biz.domain.log.query.LogQuery;
import com.ahcloud.edas.gatewaylog.biz.domain.log.vo.GatewayAccessLogDetailVO;
import com.ahcloud.edas.gatewaylog.biz.domain.log.vo.GatewayAccessLogVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @program: ahcloud-operatelog
 * @description:
 * @author: YuKai Fan
 * @create: 2024/6/6 10:46
 **/
@RestController
@RequestMapping("/gateway/accessLog")
public class GatewayAccessLogController {
    @Resource
    private GatewayAccessLogManager gatewayAccessLogManager;

    /**
     * 分页查询日志列表
     * @param query
     * @return
     */
    @GetMapping("/page")
    public ResponseResult<PageResult<GatewayAccessLogVO>> pageGatewayAccessLogList(LogListQuery query) {
        return ResponseResult.ofSuccess(gatewayAccessLogManager.pageGatewayLogList(query));
    }

    /**
     * 查询日志详情
     * @param query
     * @return
     */
    @GetMapping("/findDetail")
    public ResponseResult<GatewayAccessLogDetailVO> findGatewayAccessLogDetail(LogQuery query) {
        return ResponseResult.ofSuccess(gatewayAccessLogManager.findGatewayAccessLogDetail(query));
    }
}
